import Mock, { Random } from 'mockjs'
export default {
  gateway: {
    url: '/gateway',
    type: 'get',
    data: Mock.mock({
      code: 0,
      'data|1-10': [{
        'name': function(){
          return Random.cword(3,5)
        }
      }]
    })
  },
  device: {
    url: '/device',
    type: 'get',
    data: Mock.mock({
      code: 0,
      'data|1-10': [{
        'name': function(){
          return Random.cword(3,5)
        }
      }]
    })
  },
  chanel: {
    url: '/chanel',
    type: 'get',
    data: Mock.mock({
      code: 0,
      'data|1-10': [{
        'name': function(){
          return Random.cword(3,5)
        }
      }]
    })
  },
  tag: {
    url: '/tag',
    type: 'get',
    data: Mock.mock({
      code: 0,
      'data|1-10': [{
        'name': function(){
          return Random.cword(3,5)
        }
      }]
    })
  },

  sysParams: {
    url: '/sysParams',
    type: 'get',
    data: Mock.mock({
      code: 0,
      'data': {
        'twoByteInt': [{
          name:  Random.word(3,5),
          code: Random.integer(1,10),
        }],
        'fourByteInt': [{
          name:  Random.word(3,5),
          code: Random.integer(1,10),
        }],
        'fourByteFloat': [{
          name:  Random.word(3,5),
          code: Random.integer(1,10),
        }],
        'eightByteFloat': [{
          name:  Random.word(3,5),
          code: Random.integer(1,10),
        }],
        'string':  [{
          name:  Random.word(3,5),
          code: Random.integer(1,10),
        }],
        'gatewayType':  [{
          name:  Random.word(3,5),
          code: Random.integer(1,10),
        }],
        'protocol':  [{
          name:  Random.word(3,5),
          code: Random.integer(1,10),
        }],
      }
    })
  },
  user: {
    url: '/user',
    type: 'get',
    data: Mock.mock({
      code: 0,
      'data|1-10': [{
        'name': function(){
          return Random.cword(3,5)
        },
        'password': Random.word(6,10),
        'theme': Random.word(6,10),
        'createTime': Random.datetime()
      }]
    })
  },

  ip: {
    url: '/ip',
    type: 'get',
    data: Mock.mock({
      code: 0,
      'data|1-10': [{
        'DHCP': Random.integer(0,1),
        'IP': function(){
          return '192.168.1.' +  Random.integer(0,255)
        },
        'subnetMask': function(){
          return '192.168.1.' +  Random.integer(0,255)
        },
        'gatewayIP': function(){
          return '192.168.1.' +  Random.integer(0,255)
        },
        'DNS1': function(){
          return '192.168.1.' +  Random.integer(0,255)
        },
        'DNS2': function(){
          return '192.168.1.' +  Random.integer(0,255)
        },
      }]
    })
  },
  userDeviceTag: {
    url: '/user/deviceTag',
    type: 'get',
    data: Mock.mock({
      code: 0,
      'data|20': [{
        'name': function(){
          return Random.cword(3,5)
        },
        'password': Random.word(6,10),
        'theme': Random.word(6,10),
        'createTime': Random.datetime()
      }]
    })
  },
}